<template>
    <div id="cesiumContainer">
    </div>
</template>
  
<script>
export default {
    name: 'Box',
    components: {},
    mounted() {
        this.initViewer()
    },
    methods: {
        async initViewer() {
            Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI0ZTk4Y2FhYS1jZWY0LTQ5ZmYtOTdjYS03MzA2MzQ2NzlkZTIiLCJpZCI6MjU1MjM1LCJpYXQiOjE3NDgzMTI5MDB9.e_cOgNV_LVan_lLlPk1YVCfGFGlZNq3AajvlYL89E3M";
             this.viewer = new Cesium.Viewer('cesiumContainer', {
                imageryProvider: new window.Cesium.ArcGisMapServerImageryProvider({
                    url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
                }),
                animation: false,//是否创建动画小器件，左下角仪表
                baseLayerPicker: false,//是否显示图层选择器
                creditsDisplay: false,
                fullscreenButton : false,//是否显示全屏按钮
                geocoder : false,//是否显示geocoder小器件，右上角查询按钮
                homeButton : false,//是否显示Home按钮
                infoBox:false,//点击要素之后显示的信息,默认true
                navigationHelpButton: false,//是否显示右上角的帮助按钮
                navigation: true, // 显示导航控件
                sceneModePicker : false,//是否显示3D/2D选择器
                selectionIndicator:false,//选中元素显示,默认true
                showSelection:false,
                shouldAnimate: false,
                timeline: false,//是否显示时间轴  
                // globe: false,
                // 注释时相当于使用默认地形，解开注释相当于使用全球地形
                //  terrainProvider: Cesium.createWorldTerrain()
            });
            this.viewer.scene.sun.show = false;
            this.viewer.scene.moon.show = false;
            this.viewer.scene.skyBox.show = false; //关闭天空盒，否则会显示天空颜色
            this.viewer.scene.globe.show = true;
            // this.viewer.scene.screenSpaceCameraController.tiltEventTypes = [];//禁止视角转动
            // this.viewer.scene.screenSpaceCameraController.enableRotate=false;
            this.viewer.scene.screenSpaceCameraController.enableTilt = true
            this.viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
            // // 不加载默认bing的卫星图
            // this.viewer.imageryLayers.get(0).show = false
            this.viewer.scene.fxaa = false
            this.viewer.scene.postProcessStages.fxaa.enabled = false

            this.viewer._cesiumWidget._supportsImageRenderingPixelated = Cesium.FeatureDetection.supportsImageRenderingPixelated();
            this.viewer._cesiumWidget._forceResize = true;
        }
    }
}
</script>
  
<style>
#cesiumContainer {
    width: 100%;
    height: 100%;
}
</style>
  